
package nkr1pt.popkorn.events;

/**
 *
 * @author Kristof Vanhaeren
 */
public class PopkornEvent {

    public enum EventType {
        DOWNLOADCANDIDATE_CREATED,
        DOWNLOADCANDIDATE_DELETED,
        DOWNLOADCANDIDATE_MODIFIED,
        DOWNLOAD_COMPLETED,
        DOWNLOAD_FAILED,
        DOWNLOAD_STARTED,
        EXTRACTION_COMPLETED,
        EXTRACTION_STARTED,
        EXTRACTION_FAILED,
        PROPERTYFILE_CHANGED,
        STATUS,
        SCHEDULE_IMMEDATE,
        SCHEDULE_NIGHT;
    }

    protected String source;

    protected EventType type;

    protected Exception exception;

    public PopkornEvent(String source, EventType type) {
        this.source = source;
        this.type = type;
    }

    public String getSource() {
        return source;
    }

    public EventType getType() {
        return type;
    }

    public boolean hasException () {
        return exception != null;
    }

    public Exception getException() {
        return exception;
    }

    public void setException(Exception exception) {
        this.exception = exception;
    }

}